<!--oms订单表-->
<script setup lang="ts">
    import {AxiosPromise} from "axios";
    import lodash from 'lodash-es'

    defineOptions({
        name: "OdsOmsRetailSalesOrderMain",
        inheritAttrs: false,
    });

    import {ElLoading, UploadFile} from "element-plus";
    import {
        getOdsOmsRetailSalesOrderMainPage,
        getOdsOmsRetailSalesOrderMainForm,
        saveOdsOmsRetailSalesOrderMain,
        deleteOdsOmsRetailSalesOrderMain,
        importOdsOmsRetailSalesOrderMain,
        exportOdsOmsRetailSalesOrderMain
    } from "@/api/odsOmsRetailSalesOrderMain";

    const queryFormRef = ref(ElForm);
    const dataFormRef = ref(ElForm);

    const loading = ref(false);
    const ids = ref<number[]>([]);
    const total = ref(0);

    const queryParams = reactive<any>({
        pageNum: 1,
        pageSize: 20,
    });

    const odsOmsRetailSalesOrderMainList = ref<[]>();

    const dialog = reactive<DialogOption>({
        visible: false,
    });
    const importDialog = reactive<DialogOption>({
        title: "oms订单表数据导入",
        visible: false,
    });

    const excelFile = ref<File>();
    const excelFilelist = ref<File[]>([]);
    const formData = reactive<any>({});

    const rules = reactive({
        orderSn: [{ required: true, message: "请输入订单号", trigger: "blur" }],
        dealCode: [{ required: true, message: "请输入交易号", trigger: "blur" }],
        lylx: [{ required: true, message: "请输入来源类型", trigger: "blur" }],
        sdId: [{ required: true, message: "请输入商店id", trigger: "blur" }],
        orderStatus: [{ required: true, message: "请输入订单状态", trigger: "blur" }],
        shippingStatus: [{ required: true, message: "请输入订单配送状态", trigger: "blur" }],
        payStatus: [{ required: true, message: "请输入订单支付状态", trigger: "blur" }],
        shippingCode: [{ required: true, message: "请输入快递编码", trigger: "blur" }],
        shippingName: [{ required: true, message: "请输入快递名称", trigger: "blur" }],
        shippingSn: [{ required: true, message: "请输入快递单号", trigger: "blur" }],
        shippingFee: [{ required: true, message: "请输入快递费用", trigger: "blur" }],
        serviceOrderFee: [{ required: true, message: "请输入服务订单总费用", trigger: "blur" }],
        totalAmount: [{ required: true, message: "请输入订单总金额", trigger: "blur" }],
        payment: [{ required: true, message: "请输入已付金额", trigger: "blur" }],
        orderAmount: [{ required: true, message: "请输入应付金额", trigger: "blur" }],
        isSplit: [{ required: true, message: "请输入是否被拆分", trigger: "blur" }],
        isSplitNew: [{ required: true, message: "请输入是否拆分子单", trigger: "blur" }],
        isCombine: [{ required: true, message: "请输入是否被合并", trigger: "blur" }],
        isCombineNew: [{ required: true, message: "请输入是否合并新单", trigger: "blur" }],
        isCopy: [{ required: true, message: "请输入是否复制单", trigger: "blur" }],
        isHh: [{ required: true, message: "请输入是否换货单", trigger: "blur" }],
        orderMsg: [{ required: true, message: "请输入订单备注", trigger: "blur" }],
        sellerMsg: [{ required: true, message: "请输入商家留言", trigger: "blur" }],
        sellerFlag: [{ required: true, message: "请输入卖家备注旗帜", trigger: "blur" }],
        buyMsg: [{ required: true, message: "请输入买家留言", trigger: "blur" }],
        userName: [{ required: true, message: "请输入收货人昵称", trigger: "blur" }],
        receiverName: [{ required: true, message: "请输入收货姓名", trigger: "blur" }],
        receiverAddress: [{ required: true, message: "请输入收货地址", trigger: "blur" }],
        receiverTel: [{ required: true, message: "请输入收货电话", trigger: "blur" }],
        receiverMobile: [{ required: true, message: "请输入收货手机号", trigger: "blur" }],
        weigh: [{ required: true, message: "请输入总重量(单位KG)", trigger: "blur" }],
        addTime: [{ required: true, message: "请输入下单时间", trigger: "blur" }],
        payTime: [{ required: true, message: "请输入支付时间", trigger: "blur" }],
        shippingTimeFh: [{ required: true, message: "请输入发货时间", trigger: "blur" }],
        shippingTimeCk: [{ required: true, message: "请输入出库时间", trigger: "blur" }],
        lastchanged: [{ required: true, message: "请输入", trigger: "blur" }],
        discountFee: [{ required: true, message: "请输入订单商品折让", trigger: "blur" }],
        otherDiscountFee: [{ required: true, message: "请输入订单其他折让(整单折让)", trigger: "blur" }],
        completeTime: [{ required: true, message: "请输入客户确认收货（完成）时间戳", trigger: "blur" }],
        transTime: [{ required: true, message: "请输入转单时间", trigger: "blur" }],
        syncTime: [{ required: true, message: "请输入推送时间", trigger: "blur" }],
        userId: [{ required: true, message: "请输入", trigger: "blur" }],
        confirmTime: [{ required: true, message: "请输入确认时间", trigger: "blur" }],
        shippingTimeTzph: [{ required: true, message: "请输入通知配货时间", trigger: "blur" }],
        isHandup: [{ required: true, message: "请输入是否挂起", trigger: "blur" }],
        oaid: [{ required: true, message: "请输入", trigger: "blur" }],
        isShougong: [{ required: true, message: "请输入", trigger: "blur" }],
        storageMessage: [{ required: true, message: "请输入仓库留言", trigger: "blur" }],
        tmHhId: [{ required: true, message: "请输入", trigger: "blur" }],
        receiverProvinceName: [{ required: true, message: "请输入收货地址省", trigger: "blur" }],
        receiverCityName: [{ required: true, message: "请输入收货地址市", trigger: "blur" }],
        receiverDistrictName: [{ required: true, message: "请输入收货地址区", trigger: "blur" }],
        tbfxId: [{ required: true, message: "请输入淘宝分销采购单号", trigger: "blur" }],
        o2oGuideId: [{ required: true, message: "请输入", trigger: "blur" }],
        o2oShopId: [{ required: true, message: "请输入", trigger: "blur" }],
        sdCode: [{ required: true, message: "请输入店铺代码", trigger: "blur" }],
        sdName: [{ required: true, message: "请输入店铺名称", trigger: "blur" }],
        fhck: [{ required: true, message: "请输入发货仓库代码", trigger: "blur" }],
        fhckmc: [{ required: true, message: "请输入仓库名称", trigger: "blur" }],
        qdCode: [{ required: true, message: "请输入渠道代码", trigger: "blur" }],
        qdName: [{ required: true, message: "请输入渠道名称", trigger: "blur" }],
        lastUpdate: [{ required: true, message: "请输入订单变动时间", trigger: "blur" }],
        isElectronic: [{ required: true, message: "请输入", trigger: "blur" }],
        orderQrr: [{ required: true, message: "请输入订单确认人", trigger: "blur" }],
        i4: [{ required: true, message: "请输入", trigger: "blur" }],
        oriDealCode: [{ required: true, message: "请输入换货原始交易号", trigger: "blur" }],
        oriOrderSn: [{ required: true, message: "请输入换货原始订单号", trigger: "blur" }],
        paySn: [{ required: true, message: "请输入支付流水号", trigger: "blur" }],
        orderCustomType: [{ required: true, message: "请输入", trigger: "blur" }],
        kfOrderId: [{ required: true, message: "请输入", trigger: "blur" }],
        kfOrderIdName: [{ required: true, message: "请输入", trigger: "blur" }],
        kfOrderIdCode: [{ required: true, message: "请输入", trigger: "blur" }],
        kfXsId: [{ required: true, message: "请输入", trigger: "blur" }],
        kfXsIdName: [{ required: true, message: "请输入", trigger: "blur" }],
        kfXsIdCode: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceCount: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceAmount: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceType: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceNumber: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceTitle: [{ required: true, message: "请输入", trigger: "blur" }],
        invoicePay: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceContent: [{ required: true, message: "请输入", trigger: "blur" }],
        invoicePhone: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceAddr: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceAccount: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceBank: [{ required: true, message: "请输入", trigger: "blur" }],
        invoiceTaxNo: [{ required: true, message: "请输入", trigger: "blur" }],
        totalFxsPrice: [{ required: true, message: "请输入", trigger: "blur" }],
        tagsName: [{ required: true, message: "请输入", trigger: "blur" }],
        wmsSyncStatus: [{ required: true, message: "请输入WMS回传E3发货状态（0：未处理，1：成功，2：失败）", trigger: "blur" }],
        hhdjyh: [{ required: true, message: "请输入", trigger: "blur" }],
    });




    /**
     * 查询
     */
    function handleQuery() {
        loading.value = true;
        getOdsOmsRetailSalesOrderMainPage(queryParams)
            .then(({ data }) => {
                odsOmsRetailSalesOrderMainList.value = data.list;
                total.value = data.total;
            })
            .finally(() => {
                loading.value = false;
            });
    }

    /**
     * 重置查询
     */
    function resetQuery() {
        queryFormRef.value.resetFields();
        queryParams.pageNum = 1;
        handleQuery();
    }

    /**
     * 行checkbox change事件
     */
    function handleSelectionChange(selection: any) {
        ids.value = selection.map((item: any) => item.id);
    }

    /**
     * 打开字典类型表单弹窗
     *
     * @param dicTypeId 字典类型ID
     */
    function openDialog(id?: number) {
        dialog.visible = true;
        if (id) {
            dialog.title = "修改oms订单表";
            getOdsOmsRetailSalesOrderMainForm(id).then(({ data }) => {
                Object.assign(formData, data);
            });
        } else {
            dialog.title = "新增oms订单表";
        }
    }

    /**
     * 字典类型表单提交
     */
    function handleSubmit() {
        dataFormRef.value.validate((isValid: boolean) => {
            if (isValid) {
                loading.value = false;
                saveOdsOmsRetailSalesOrderMain(formData)
                    .then(() => {
                        ElMessage.success("保存成功");
                        closeDialog();
                        handleQuery();
                    })
                    .finally(() => (loading.value = false));
            }
        });
    }

    /**
     * 关闭弹窗
     */
    function closeDialog() {
        dialog.visible = false;
        resetForm();
    }

    /**
     * 重置表单
     */
    function resetForm() {
        dataFormRef.value.resetFields();
        dataFormRef.value.clearValidate();

        formData.id = undefined;
    }

    /**
     * 删除oms订单表
     */
    function handleDelete(id?: number) {
        const dictTypeIds = [id || ids.value].join(",");
        if (!dictTypeIds) {
            ElMessage.warning("请勾选删除项");
            return;
        }

        ElMessageBox.confirm("确认删除已选中的数据项?", "警告", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
        }).then(() => {
            deleteOdsOmsRetailSalesOrderMain(dictTypeIds).then(() => {
                ElMessage.success("删除成功");
                resetQuery();
            });
        });
    }

    /** 打开导入弹窗 */
    async function openImportDialog() {
        importDialog.visible = true;
    }

    /**
     * Excel文件change事件
     *
     * @param file
     */
    function handleExcelChange(file: UploadFile) {
        if (file.size !== undefined) {
            if (file.size > 20*1024*1024) {
                ElMessage.warning("上传文件大小不能超过20M");
                return false
            }
        }
        if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
            ElMessage.warning("上传Excel只能为xlsx、xls格式");
            excelFile.value = undefined;
            excelFilelist.value = [];
            return false;
        }
        excelFile.value = file.raw;
    }

    /** 导入提交 */
    function handleImport() {
        if (!excelFile.value) {
            ElMessage.warning("上传Excel文件不能为空");
            return false;
        }
        const importLoading = ElLoading.service({
            lock: true,
            text: '导入中...',
            background: 'rgba(0, 0, 0, 0.7)',
        })
        importOdsOmsRetailSalesOrderMain(excelFile.value).then((response) => {

            closeImportDialog();
            ElMessage.success('导入成功');
            resetQuery();
        }).finally(() => importLoading.close());
    }

    /**  关闭导入弹窗 */
    function closeImportDialog() {
        importDialog.visible = false;
        excelFile.value = undefined;
        excelFilelist.value = [];
    }

    /** 导出oms订单表 */
    function handleExport() {
        const strIds = [ids.value].join(",");
        exportOdsOmsRetailSalesOrderMain(strIds).then((response: any) => {
            const blob = new Blob([response.data], {
                type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
            });
            const a = document.createElement("a");
            const href = window.URL.createObjectURL(blob); // 下载的链接
            a.href = href;
            a.download = decodeURI(
                response.headers["content-disposition"].split(";")[1].split("=")[1]
            ); // 获取后台设置的文件名称
            document.body.appendChild(a);
            a.click(); // 点击导出
            document.body.removeChild(a); // 下载完成移除元素
            window.URL.revokeObjectURL(href); // 释放掉blob对象
        });
    }

    onMounted(() => {
        handleQuery();
    });
</script>

<template>
    <div class="app-container">
        <div class="search-container">
            <el-form ref="queryFormRef" :model="queryParams" :inline="true">
                <el-form-item label="关键词" prop="keywords">
                    <el-input
                            v-model="queryParams.keywords"
                            placeholder="关键词"
                            clearable
                            @keyup.enter="handleQuery"
                    />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleQuery()"
                    ><i-ep-search />搜索</el-button
                    >
                    <el-button @click="resetQuery()"><i-ep-refresh />重置</el-button>
                </el-form-item>
            </el-form>
        </div>

        <el-card shadow="never">
            <template #header>
                <div class="flex justify-between">
                    <div>
                        <el-button
                                v-hasPerm="['sys:odsOmsRetailSalesOrderMain:save']"
                                type="success"
                                @click="openDialog()"
                        ><i-ep-plus />新增</el-button
                        >
                        <el-button
                                type="danger"
                                :disabled="ids.length === 0"
                                @click="handleDelete()"
                                v-hasPerm="['sys:odsOmsRetailSalesOrderMain:delete']"
                        ><i-ep-delete />删除</el-button
                        >
                    </div>
                    <div>
                        <el-button class="ml-3" @click="openImportDialog" v-hasPerm="['sys:odsOmsRetailSalesOrderMain:import']"
                        ><template #icon><i-ep-top /></template>导入</el-button
                        >
                        <el-button class="ml-3" @click="handleExport" v-hasPerm="['sys:odsOmsRetailSalesOrderMain:export']"
                        ><template #icon><i-ep-download /></template>导出</el-button
                        >
                    </div>
                </div>
            </template>
            <el-table
                    size="small"
                    :header-row-style="{color: 'dimgray'}"
                    v-loading="loading"
                    highlight-current-row
                    :data="odsOmsRetailSalesOrderMainList"
                    border
                    @selection-change="handleSelectionChange"
                    :height="odsOmsRetailSalesOrderMainList && odsOmsRetailSalesOrderMainList.length > 0 ? 580 : 130"
            >
                <el-table-column type="selection" width="40" align="center" show-overflow-tooltip />
                <el-table-column label="订单号" prop="orderSn" width="100" show-overflow-tooltip/>
                <el-table-column label="交易号" prop="dealCode" width="100" show-overflow-tooltip/>
                <el-table-column label="来源类型" prop="lylx" width="100" show-overflow-tooltip/>
                <el-table-column label="商店id" prop="sdId" width="100" show-overflow-tooltip/>
                <el-table-column label="订单状态" prop="orderStatus" width="100" show-overflow-tooltip/>
                <el-table-column label="订单配送状态" prop="shippingStatus" width="100" show-overflow-tooltip/>
                <el-table-column label="订单支付状态" prop="payStatus" width="100" show-overflow-tooltip/>
                <el-table-column label="快递编码" prop="shippingCode" width="100" show-overflow-tooltip/>
                <el-table-column label="快递名称" prop="shippingName" width="100" show-overflow-tooltip/>
                <el-table-column label="快递单号" prop="shippingSn" width="100" show-overflow-tooltip/>
                <el-table-column label="快递费用" prop="shippingFee" width="100" show-overflow-tooltip/>
                <el-table-column label="服务订单总费用" prop="serviceOrderFee" width="100" show-overflow-tooltip/>
                <el-table-column label="订单总金额" prop="totalAmount" width="100" show-overflow-tooltip/>
                <el-table-column label="已付金额" prop="payment" width="100" show-overflow-tooltip/>
                <el-table-column label="应付金额" prop="orderAmount" width="100" show-overflow-tooltip/>
                <el-table-column label="是否被拆分" prop="isSplit" width="100" show-overflow-tooltip/>
                <el-table-column label="是否拆分子单" prop="isSplitNew" width="100" show-overflow-tooltip/>
                <el-table-column label="是否被合并" prop="isCombine" width="100" show-overflow-tooltip/>
                <el-table-column label="是否合并新单" prop="isCombineNew" width="100" show-overflow-tooltip/>
                <el-table-column label="是否复制单" prop="isCopy" width="100" show-overflow-tooltip/>
                <el-table-column label="是否换货单" prop="isHh" width="100" show-overflow-tooltip/>
                <el-table-column label="订单备注" prop="orderMsg" width="100" show-overflow-tooltip/>
                <el-table-column label="商家留言" prop="sellerMsg" width="100" show-overflow-tooltip/>
                <el-table-column label="卖家备注旗帜" prop="sellerFlag" width="100" show-overflow-tooltip/>
                <el-table-column label="买家留言" prop="buyMsg" width="100" show-overflow-tooltip/>
                <el-table-column label="收货人昵称" prop="userName" width="100" show-overflow-tooltip/>
                <el-table-column label="收货姓名" prop="receiverName" width="100" show-overflow-tooltip/>
                <el-table-column label="收货地址" prop="receiverAddress" width="100" show-overflow-tooltip/>
                <el-table-column label="收货电话" prop="receiverTel" width="100" show-overflow-tooltip/>
                <el-table-column label="收货手机号" prop="receiverMobile" width="100" show-overflow-tooltip/>
                <el-table-column label="总重量(单位KG)" prop="weigh" width="100" show-overflow-tooltip/>
                <el-table-column label="下单时间" prop="addTime" width="100" show-overflow-tooltip/>
                <el-table-column label="支付时间" prop="payTime" width="100" show-overflow-tooltip/>
                <el-table-column label="发货时间" prop="shippingTimeFh" width="100" show-overflow-tooltip/>
                <el-table-column label="出库时间" prop="shippingTimeCk" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="lastchanged" width="100" show-overflow-tooltip/>
                <el-table-column label="订单商品折让" prop="discountFee" width="100" show-overflow-tooltip/>
                <el-table-column label="订单其他折让(整单折让)" prop="otherDiscountFee" width="100" show-overflow-tooltip/>
                <el-table-column label="客户确认收货（完成）时间戳" prop="completeTime" width="100" show-overflow-tooltip/>
                <el-table-column label="转单时间" prop="transTime" width="100" show-overflow-tooltip/>
                <el-table-column label="推送时间" prop="syncTime" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="userId" width="100" show-overflow-tooltip/>
                <el-table-column label="确认时间" prop="confirmTime" width="100" show-overflow-tooltip/>
                <el-table-column label="通知配货时间" prop="shippingTimeTzph" width="100" show-overflow-tooltip/>
                <el-table-column label="是否挂起" prop="isHandup" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="oaid" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="isShougong" width="100" show-overflow-tooltip/>
                <el-table-column label="仓库留言" prop="storageMessage" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="tmHhId" width="100" show-overflow-tooltip/>
                <el-table-column label="收货地址省" prop="receiverProvinceName" width="100" show-overflow-tooltip/>
                <el-table-column label="收货地址市" prop="receiverCityName" width="100" show-overflow-tooltip/>
                <el-table-column label="收货地址区" prop="receiverDistrictName" width="100" show-overflow-tooltip/>
                <el-table-column label="淘宝分销采购单号" prop="tbfxId" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="o2oGuideId" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="o2oShopId" width="100" show-overflow-tooltip/>
                <el-table-column label="店铺代码" prop="sdCode" width="100" show-overflow-tooltip/>
                <el-table-column label="店铺名称" prop="sdName" width="100" show-overflow-tooltip/>
                <el-table-column label="发货仓库代码" prop="fhck" width="100" show-overflow-tooltip/>
                <el-table-column label="仓库名称" prop="fhckmc" width="100" show-overflow-tooltip/>
                <el-table-column label="渠道代码" prop="qdCode" width="100" show-overflow-tooltip/>
                <el-table-column label="渠道名称" prop="qdName" width="100" show-overflow-tooltip/>
                <el-table-column label="订单变动时间" prop="lastUpdate" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="isElectronic" width="100" show-overflow-tooltip/>
                <el-table-column label="订单确认人" prop="orderQrr" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="i4" width="100" show-overflow-tooltip/>
                <el-table-column label="换货原始交易号" prop="oriDealCode" width="100" show-overflow-tooltip/>
                <el-table-column label="换货原始订单号" prop="oriOrderSn" width="100" show-overflow-tooltip/>
                <el-table-column label="支付流水号" prop="paySn" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="orderCustomType" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="kfOrderId" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="kfOrderIdName" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="kfOrderIdCode" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="kfXsId" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="kfXsIdName" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="kfXsIdCode" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceCount" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceAmount" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceType" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceNumber" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceTitle" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoicePay" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceContent" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoicePhone" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceAddr" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceAccount" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceBank" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="invoiceTaxNo" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="totalFxsPrice" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="tagsName" width="100" show-overflow-tooltip/>
                <el-table-column label="WMS回传E3发货状态（0：未处理，1：成功，2：失败）" prop="wmsSyncStatus" width="100" show-overflow-tooltip/>
                <el-table-column label="" prop="hhdjyh" width="100" show-overflow-tooltip/>
                <el-table-column label="" show-overflow-tooltip/>
                <el-table-column fixed="right" label="操作" align="center" width="120">
                    <template #default="scope">
                        <el-button
                                v-hasPerm="['sys:odsOmsRetailSalesOrderMain:save']"
                                type="primary"
                                link
                                size="small"
                                @click.stop="openDialog(scope.row.id)"
                        ><i-ep-edit />编辑</el-button
                        >
                        <el-button
                                v-hasPerm="['sys:odsOmsRetailSalesOrderMain:delete']"
                                type="primary"
                                link
                                size="small"
                                @click.stop="handleDelete(scope.row.id)"
                        ><i-ep-delete />删除</el-button
                        >
                    </template>
                </el-table-column>
            </el-table>

            <pagination
                    v-if="total > 0"
                    v-model:total="total"
                    v-model:page="queryParams.pageNum"
                    v-model:limit="queryParams.pageSize"
                    @pagination="handleQuery"
            />
        </el-card>

        <el-dialog
                v-model="dialog.visible"
                :title="dialog.title"
                width="500px"
                :close-on-click-modal="false"
                @close="closeDialog"
        >
            <el-form
                    ref="dataFormRef"
                    :model="formData"
                    :rules="rules"
                    label-width="150px"
            >
                    <el-form-item label="订单号" prop="orderSn">
                        <el-input v-model="formData.orderSn" placeholder="请输入订单号" clearable/>
                    </el-form-item>
                    <el-form-item label="交易号" prop="dealCode">
                        <el-input v-model="formData.dealCode" placeholder="请输入交易号" clearable/>
                    </el-form-item>
                    <el-form-item label="来源类型" prop="lylx">
                        <el-input v-model="formData.lylx" placeholder="请输入来源类型" clearable/>
                    </el-form-item>
                    <el-form-item label="商店id" prop="sdId">
                        <el-input v-model="formData.sdId" placeholder="请输入商店id" clearable/>
                    </el-form-item>
                    <el-form-item label="订单状态" prop="orderStatus">
                        <el-input v-model="formData.orderStatus" placeholder="请输入订单状态" clearable/>
                    </el-form-item>
                    <el-form-item label="订单配送状态" prop="shippingStatus">
                        <el-input v-model="formData.shippingStatus" placeholder="请输入订单配送状态" clearable/>
                    </el-form-item>
                    <el-form-item label="订单支付状态" prop="payStatus">
                        <el-input v-model="formData.payStatus" placeholder="请输入订单支付状态" clearable/>
                    </el-form-item>
                    <el-form-item label="快递编码" prop="shippingCode">
                        <el-input v-model="formData.shippingCode" placeholder="请输入快递编码" clearable/>
                    </el-form-item>
                    <el-form-item label="快递名称" prop="shippingName">
                        <el-input v-model="formData.shippingName" placeholder="请输入快递名称" clearable/>
                    </el-form-item>
                    <el-form-item label="快递单号" prop="shippingSn">
                        <el-input v-model="formData.shippingSn" placeholder="请输入快递单号" clearable/>
                    </el-form-item>
                    <el-form-item label="快递费用" prop="shippingFee">
                        <el-input v-model="formData.shippingFee" placeholder="请输入快递费用" clearable/>
                    </el-form-item>
                    <el-form-item label="服务订单总费用" prop="serviceOrderFee">
                        <el-input v-model="formData.serviceOrderFee" placeholder="请输入服务订单总费用" clearable/>
                    </el-form-item>
                    <el-form-item label="订单总金额" prop="totalAmount">
                        <el-input v-model="formData.totalAmount" placeholder="请输入订单总金额" clearable/>
                    </el-form-item>
                    <el-form-item label="已付金额" prop="payment">
                        <el-input v-model="formData.payment" placeholder="请输入已付金额" clearable/>
                    </el-form-item>
                    <el-form-item label="应付金额" prop="orderAmount">
                        <el-input v-model="formData.orderAmount" placeholder="请输入应付金额" clearable/>
                    </el-form-item>
                    <el-form-item label="是否被拆分" prop="isSplit">
                        <el-input v-model="formData.isSplit" placeholder="请输入是否被拆分" clearable/>
                    </el-form-item>
                    <el-form-item label="是否拆分子单" prop="isSplitNew">
                        <el-input v-model="formData.isSplitNew" placeholder="请输入是否拆分子单" clearable/>
                    </el-form-item>
                    <el-form-item label="是否被合并" prop="isCombine">
                        <el-input v-model="formData.isCombine" placeholder="请输入是否被合并" clearable/>
                    </el-form-item>
                    <el-form-item label="是否合并新单" prop="isCombineNew">
                        <el-input v-model="formData.isCombineNew" placeholder="请输入是否合并新单" clearable/>
                    </el-form-item>
                    <el-form-item label="是否复制单" prop="isCopy">
                        <el-input v-model="formData.isCopy" placeholder="请输入是否复制单" clearable/>
                    </el-form-item>
                    <el-form-item label="是否换货单" prop="isHh">
                        <el-input v-model="formData.isHh" placeholder="请输入是否换货单" clearable/>
                    </el-form-item>
                    <el-form-item label="订单备注" prop="orderMsg">
                        <el-input v-model="formData.orderMsg" placeholder="请输入订单备注" clearable/>
                    </el-form-item>
                    <el-form-item label="商家留言" prop="sellerMsg">
                        <el-input v-model="formData.sellerMsg" placeholder="请输入商家留言" clearable/>
                    </el-form-item>
                    <el-form-item label="卖家备注旗帜" prop="sellerFlag">
                        <el-input v-model="formData.sellerFlag" placeholder="请输入卖家备注旗帜" clearable/>
                    </el-form-item>
                    <el-form-item label="买家留言" prop="buyMsg">
                        <el-input v-model="formData.buyMsg" placeholder="请输入买家留言" clearable/>
                    </el-form-item>
                    <el-form-item label="收货人昵称" prop="userName">
                        <el-input v-model="formData.userName" placeholder="请输入收货人昵称" clearable/>
                    </el-form-item>
                    <el-form-item label="收货姓名" prop="receiverName">
                        <el-input v-model="formData.receiverName" placeholder="请输入收货姓名" clearable/>
                    </el-form-item>
                    <el-form-item label="收货地址" prop="receiverAddress">
                        <el-input v-model="formData.receiverAddress" placeholder="请输入收货地址" clearable/>
                    </el-form-item>
                    <el-form-item label="收货电话" prop="receiverTel">
                        <el-input v-model="formData.receiverTel" placeholder="请输入收货电话" clearable/>
                    </el-form-item>
                    <el-form-item label="收货手机号" prop="receiverMobile">
                        <el-input v-model="formData.receiverMobile" placeholder="请输入收货手机号" clearable/>
                    </el-form-item>
                    <el-form-item label="总重量(单位KG)" prop="weigh">
                        <el-input v-model="formData.weigh" placeholder="请输入总重量(单位KG)" clearable/>
                    </el-form-item>
                    <el-form-item label="下单时间" prop="addTime">
                        <el-input v-model="formData.addTime" placeholder="请输入下单时间" clearable/>
                    </el-form-item>
                    <el-form-item label="支付时间" prop="payTime">
                        <el-input v-model="formData.payTime" placeholder="请输入支付时间" clearable/>
                    </el-form-item>
                    <el-form-item label="发货时间" prop="shippingTimeFh">
                        <el-input v-model="formData.shippingTimeFh" placeholder="请输入发货时间" clearable/>
                    </el-form-item>
                    <el-form-item label="出库时间" prop="shippingTimeCk">
                        <el-input v-model="formData.shippingTimeCk" placeholder="请输入出库时间" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="lastchanged">
                        <el-input v-model="formData.lastchanged" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="订单商品折让" prop="discountFee">
                        <el-input v-model="formData.discountFee" placeholder="请输入订单商品折让" clearable/>
                    </el-form-item>
                    <el-form-item label="订单其他折让(整单折让)" prop="otherDiscountFee">
                        <el-input v-model="formData.otherDiscountFee" placeholder="请输入订单其他折让(整单折让)" clearable/>
                    </el-form-item>
                    <el-form-item label="客户确认收货（完成）时间戳" prop="completeTime">
                        <el-input v-model="formData.completeTime" placeholder="请输入客户确认收货（完成）时间戳" clearable/>
                    </el-form-item>
                    <el-form-item label="转单时间" prop="transTime">
                        <el-input v-model="formData.transTime" placeholder="请输入转单时间" clearable/>
                    </el-form-item>
                    <el-form-item label="推送时间" prop="syncTime">
                        <el-input v-model="formData.syncTime" placeholder="请输入推送时间" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="userId">
                        <el-input v-model="formData.userId" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="确认时间" prop="confirmTime">
                        <el-input v-model="formData.confirmTime" placeholder="请输入确认时间" clearable/>
                    </el-form-item>
                    <el-form-item label="通知配货时间" prop="shippingTimeTzph">
                        <el-input v-model="formData.shippingTimeTzph" placeholder="请输入通知配货时间" clearable/>
                    </el-form-item>
                    <el-form-item label="是否挂起" prop="isHandup">
                        <el-input v-model="formData.isHandup" placeholder="请输入是否挂起" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="oaid">
                        <el-input v-model="formData.oaid" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="isShougong">
                        <el-input v-model="formData.isShougong" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="仓库留言" prop="storageMessage">
                        <el-input v-model="formData.storageMessage" placeholder="请输入仓库留言" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="tmHhId">
                        <el-input v-model="formData.tmHhId" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="收货地址省" prop="receiverProvinceName">
                        <el-input v-model="formData.receiverProvinceName" placeholder="请输入收货地址省" clearable/>
                    </el-form-item>
                    <el-form-item label="收货地址市" prop="receiverCityName">
                        <el-input v-model="formData.receiverCityName" placeholder="请输入收货地址市" clearable/>
                    </el-form-item>
                    <el-form-item label="收货地址区" prop="receiverDistrictName">
                        <el-input v-model="formData.receiverDistrictName" placeholder="请输入收货地址区" clearable/>
                    </el-form-item>
                    <el-form-item label="淘宝分销采购单号" prop="tbfxId">
                        <el-input v-model="formData.tbfxId" placeholder="请输入淘宝分销采购单号" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="o2oGuideId">
                        <el-input v-model="formData.o2oGuideId" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="o2oShopId">
                        <el-input v-model="formData.o2oShopId" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="店铺代码" prop="sdCode">
                        <el-input v-model="formData.sdCode" placeholder="请输入店铺代码" clearable/>
                    </el-form-item>
                    <el-form-item label="店铺名称" prop="sdName">
                        <el-input v-model="formData.sdName" placeholder="请输入店铺名称" clearable/>
                    </el-form-item>
                    <el-form-item label="发货仓库代码" prop="fhck">
                        <el-input v-model="formData.fhck" placeholder="请输入发货仓库代码" clearable/>
                    </el-form-item>
                    <el-form-item label="仓库名称" prop="fhckmc">
                        <el-input v-model="formData.fhckmc" placeholder="请输入仓库名称" clearable/>
                    </el-form-item>
                    <el-form-item label="渠道代码" prop="qdCode">
                        <el-input v-model="formData.qdCode" placeholder="请输入渠道代码" clearable/>
                    </el-form-item>
                    <el-form-item label="渠道名称" prop="qdName">
                        <el-input v-model="formData.qdName" placeholder="请输入渠道名称" clearable/>
                    </el-form-item>
                    <el-form-item label="订单变动时间" prop="lastUpdate">
                        <el-input v-model="formData.lastUpdate" placeholder="请输入订单变动时间" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="isElectronic">
                        <el-input v-model="formData.isElectronic" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="订单确认人" prop="orderQrr">
                        <el-input v-model="formData.orderQrr" placeholder="请输入订单确认人" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="i4">
                        <el-input v-model="formData.i4" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="换货原始交易号" prop="oriDealCode">
                        <el-input v-model="formData.oriDealCode" placeholder="请输入换货原始交易号" clearable/>
                    </el-form-item>
                    <el-form-item label="换货原始订单号" prop="oriOrderSn">
                        <el-input v-model="formData.oriOrderSn" placeholder="请输入换货原始订单号" clearable/>
                    </el-form-item>
                    <el-form-item label="支付流水号" prop="paySn">
                        <el-input v-model="formData.paySn" placeholder="请输入支付流水号" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="orderCustomType">
                        <el-input v-model="formData.orderCustomType" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="kfOrderId">
                        <el-input v-model="formData.kfOrderId" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="kfOrderIdName">
                        <el-input v-model="formData.kfOrderIdName" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="kfOrderIdCode">
                        <el-input v-model="formData.kfOrderIdCode" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="kfXsId">
                        <el-input v-model="formData.kfXsId" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="kfXsIdName">
                        <el-input v-model="formData.kfXsIdName" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="kfXsIdCode">
                        <el-input v-model="formData.kfXsIdCode" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceCount">
                        <el-input v-model="formData.invoiceCount" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceAmount">
                        <el-input v-model="formData.invoiceAmount" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceType">
                        <el-input v-model="formData.invoiceType" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceNumber">
                        <el-input v-model="formData.invoiceNumber" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceTitle">
                        <el-input v-model="formData.invoiceTitle" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoicePay">
                        <el-input v-model="formData.invoicePay" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceContent">
                        <el-input v-model="formData.invoiceContent" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoicePhone">
                        <el-input v-model="formData.invoicePhone" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceAddr">
                        <el-input v-model="formData.invoiceAddr" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceAccount">
                        <el-input v-model="formData.invoiceAccount" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceBank">
                        <el-input v-model="formData.invoiceBank" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="invoiceTaxNo">
                        <el-input v-model="formData.invoiceTaxNo" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="totalFxsPrice">
                        <el-input v-model="formData.totalFxsPrice" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="tagsName">
                        <el-input v-model="formData.tagsName" placeholder="请输入" clearable/>
                    </el-form-item>
                    <el-form-item label="WMS回传E3发货状态（0：未处理，1：成功，2：失败）" prop="wmsSyncStatus">
                        <el-input v-model="formData.wmsSyncStatus" placeholder="请输入WMS回传E3发货状态（0：未处理，1：成功，2：失败）" clearable/>
                    </el-form-item>
                    <el-form-item label="" prop="hhdjyh">
                        <el-input v-model="formData.hhdjyh" placeholder="请输入" clearable/>
                    </el-form-item>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="handleSubmit">确 定</el-button>
                    <el-button @click="closeDialog">取 消</el-button>
                </div>
            </template>
        </el-dialog>

        <!-- 导入弹窗 -->
        <el-dialog
                v-model="importDialog.visible"
                :title="importDialog.title"
                width="600px"
                append-to-body
                @close="closeImportDialog"
        >
            <el-form label-width="80px">
                <el-form-item label="Excel">
                    <el-upload
                            class="upload-demo"
                            action=""
                            drag
                            :auto-upload="false"
                            accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
                            :file-list="excelFilelist"
                            :on-change="handleExcelChange"
                            :limit="1"
                    >
                        <el-icon class="el-icon--upload">
                            <i-ep-upload-filled/>
                        </el-icon>
                        <div class="el-upload__text">
                            将文件拖到此处，或
                            <em>点击上传</em>
                        </div>
                        <template #tip>
                            <div class="el-upload__tip">xls/xlsx files</div>
                        </template>
                    </el-upload>
                </el-form-item>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="handleImport">确 定</el-button>
                    <el-button @click="closeImportDialog">取 消</el-button>
                </div>
            </template>
        </el-dialog>
    </div>
</template>
